<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title></title>
		<style type="text/css">
			ul {
				display: flex;
				width: 200px;
				/* justify-content: space-around; */
				list-style: none;
				border: 2px solid #ccc;
				margin: 0;
				padding: 0;
			}

			ul li {
				margin: 0;
				padding: 0;
				width: 100px;
				border: 1px solid #ccc;
				text-align: center;
			}

			.active {
				background: red;
			}

			.no-active {
				background: green;
			}
			section{
				border: 2px solid #ccc;
				width: 200px;
				height: 200px;
				display: none;
			}
			.show{
				display: block;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<ul>
				<li v-for="(item,index) of list" :key="item.id" @click="change(index)"
					:class="currenIndex === index ? 'active' : 'no-active'">{{item.btn}}</li>
			</ul>
			<section  v-for="(item,index) of list" :class="currenIndex === index ? 'show' : ''">{{item.con}}</section>
			<!-- <div v-show="currenIndex === index" v-for="(item,index) of list">{{item.con}}</div> -->
			
		</div>
		<script src="js/v2.6.10/vue.js" type="text/javascript" charset="utf-8"></script>

		<script type="text/javascript">
			let myApp = new Vue({
				el: '#app',
				data: {
					list: [{
							id: 1,
							btn: '按钮1',
							con: '内容1'
						},
						{
							id: 2,
							btn: '按钮2',
							con: '内容2'
						},
						{
							id: 3,
							btn: '按钮3',
							con: '内容3'
						},
					],
					currenIndex: 0
				},
				methods: {
					change(index) {
						this.currenIndex = index
					}
				}
			})
		</script>
	</body>
</html>
